<?php
session_start();
error_reporting(0);
$module = $_POST['module'];

switch ($module) {
	case "newusr" :
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/UserController.php');
		$clsDBConn = new DBConn();
		$clsUser = new User();
		$clsUser->createUser();
		break;	
		
	case "newusrreg" :
          
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/UserController.php');
		$clsDBConn = new DBConn();
		$clsUser = new User();
		$clsUser->doCreateUser();
		break;	
		
	case "login" :
          
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile(ADAPTOR . "/Login.php");
		CommonFunc::loadFile('controller/UserController.php');
		$loginhelper = new LoginHelper();
		$loginform = $loginhelper->login();
		break;
		
	case "authusr" :
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/UserController.php');
		$clsDBConn = new DBConn();
		$clsUser = new User();
		$clsUser->doLogin();
		break;
		
	case "validateqty" :
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/ProductController.php');
		$clsDBConn = new DBConn();
		$clsProduct = new Product();
		$clsProduct->validateQty();
		break;
		
	case "addtocart" :
             // print_r($_POST);
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/CartController.php');
		$clsDBConn = new DBConn();
		$clsCart = new Cart();
		$clsCart->addtoCart();
		break;
		
	case "updateqty" :
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/CartController.php');
		$clsDBConn = new DBConn();
		$clsCart = new Cart();
		$clsCart->updateCart();
		break;
		
	case "delcart" :
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/CartController.php');		
		$clsDBConn = new DBConn();
		$clsCart = new Cart();
		$clsCart->delCart();
		break;	
		
	case "savecart" :
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/CartController.php');		
		$clsDBConn = new DBConn();
		$clsCart = new Cart();
		$clsCart->saveCart();
		break;
		
	case "delsavecart" :
		include ("CONFIG.config");
		include ("DB.config");
		require (LIB . "common/common.class.php");
		require (LIB . "common/db.class.php");
		CommonFunc::loadFile('controller/CartController.php');		
		$clsDBConn = new DBConn();
		$clsCart = new Cart();
		$clsCart->delSaveCart();
		break;
		
	default:
            
		
		break;	
}
?>